<?php
include './include/class.controller.php';
include './include/class.page.php';
include 'staticpage.php';
$getValue=$_GET['page'] ;
$page=new Page($getValue);
/*these are different sections in the template file*/
$pagetitle= Page::$title;
$keywords= Page::$keywords;
$description= Page::$description;
$jslink=Page::$jslink;
// print_r(Page::$jslink);
$csslink=Page::$csslink;
$header= getHeaderContent();
$logoSection;
if($user->logged_in){
    $userMenu = $ctrl->getUserMenu();
    //$submenu= $ctrl->getUserMenu();
    $greetings=$ctrl->getGreetings();
    $mainContent= Page::$content;
}
else{
    $loginArea= $ctrl->getLoginForm();
    $menu= getMainMenu();
    $mainContent=getMainContent();
}
//$rightPanelContent= getSidebarContent();
$rightPanelContent=$ctrl->getNewsItem();
$footer=getFooterContent();
if(!$user->logged_in){
    $projects = getProjectsContent();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $pagetitle; ?></title>
<meta name="keywords" content="<?php echo $keywords; ?>" />
<meta name="description" content="<?php echo $description; ?>" />
<link href="css/default.css" rel="stylesheet" type="text/css" />
<link href="css/slideshow.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<?php //extra js files to be included is included here
    if(!empty($jslink)){
    if(is_array($jslink)){
            foreach($jslink as $js){
                echo "<script language='JavaScript' type='text/javascript' src='$js'></script>";
            } 
        }else{
            echo "<script language='JavaScript' type='text/javascript' src='$jslink'></script>";
        }
    }
        //extra css files to be included are included here
    if(!empty($csslink)){
    if(is_array($csslink)){
            foreach($csslink as $css){
                echo "<link href='$css' rel='stylesheet' type='text/css' />";
            } 
        }else{
                echo "<link href='$csslink' rel='stylesheet' type='text/css' />";
        }
    }
    ?>


<style>
html, body {
    margin: 0;
    padding: 0;
    font-size: 85%;
}
</style>
</head>
<body>
    <div id="templatemo_header_wrapper">
        <?php echo $header; ?>
    </div> <!-- end of header wrapper -->
   <!-- start of menu -->
<?php if(!empty($menu))
            {?>
    <div id="menus">
        <?php echo $menu; ?>
    </div><!-- end of menu wrapper -->
<?php } ?>
    <div id="tempatemo_content_wrapper">
        <div id="templatemo_content">
 <?php if($user->logged_in){ ?>
        <div id="column_w200">
             <div id="submenu">
               <?php echo $greetings; ?>
               <?php echo $userMenu; ?>
               <?php echo $submenu; ?>
             </div>
                <div id="submenu_arrow_left"></div>
                
                        
        </div> <!-- end of column_w200 -->  


            <div id="column_w600">            

                <div id="submenu_arrow_right"></div>
                <div id="main_content"><?php echo $mainContent; ?></div>

            </div><!-- end of column_w600 -->
                    <div class="cleaner"></div>


<?php
}
else
{ if(!empty($projects))
    { ?>
            <div class="recent_projects">
                <?php echo $projects; ?>
            </div><!-- End  recent project-->
<?php  } ?>
            <div id="content_panel">
                <div id="column_w610">
                    <?php echo $mainContent; ?>
                </div> <!-- end of column w610 -->
                
                <div id="column_w290">
                    <?php echo $loginArea; ?>    
                    <?php echo $rightPanelContent; ?>
                    <div class="cleaner"></div>
                </div> <!-- end of column 290 -->
<?php } ?>
            </div> <!-- end of content panel wrapper -->
            <div id="templatemo_footer_wrapper">
            <?php echo $footer; ?>
            </div> <!-- end of footer  wrapper-->
        </div> <!-- end of templato  content -->
    </div> <!-- end of templato  content wraper-->
</body>
</html>
